/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bllInterface;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Collection;
import java.util.HashSet;

/**
 *
 * @author salm
 */
public abstract class BaseChatUser extends UnicastRemoteObject implements iChatUser
{
    public BaseChatUser() throws RemoteException
    {
        super();
    }
    
    protected final Collection<iChatUserListener> listeners = new HashSet<>();
    
    @Override
    public void addListener(iChatUserListener listener) throws RemoteException
    {
        synchronized(this.listeners)
        {
            this.listeners.add(listener);
        }
    }
        
    @Override
    public void removeListener(iChatUserListener listener) throws RemoteException
    {
        synchronized(this.listeners)
        {
            this.listeners.remove(listener);
        }
    }
}
